<template>
  <div class="loding">
    <el-avatar :size="158" :src="avatar" v-if="avatar"></el-avatar>
    <el-avatar :size="158" :src="circleUrl" v-else></el-avatar>
    <p class="tip">正在登录…</p>
  </div>
</template>

<script>
export default {
  name: 'Loding',
  props: ['status'],
  data () {
    return {
      avatar: null,
      circleUrl: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
    }
  },
  watch: {
    status: function (val, oldVal) {
      if (val === 4) {
        this.avatar = sessionStorage.getItem('aillo_avatar')
        setTimeout(() => {
          this.$router.push('/home')
        }, 0)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.loding {
  width: 297px;
  height: 401px;
  background: rgba(255, 255, 255, 1);
  border-radius: 9px;
  margin: auto;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  .avatar {
    width: 158px;
    height: 158px;
    border-radius: 300px;
  }
  .tip {
    margin-top: 39px;
    color: #3478f5;
    font-weight: 500;
    font-size: 19px;
  }
}
</style>
